package com.lyf.config;

import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.env.Environment;
import org.springframework.core.type.AnnotatedTypeMetadata;

/**
 * @AUTHOR LYF
 * @DATE 2022/5/12
 * @VERSION 1.0
 * @DESC
 */
public class MyCondition implements Condition {
    @Override
    public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {

        Environment environment = context.getEnvironment();
        String window = environment.getProperty("os.name");

        System.out.println(window);
        if(window.contains("linux"))
            return true;
        System.out.println("进行匹配..");

        return false;
    }
}
